<template>
	<view>
		<view class="qb">
			<view class="qb_item">
				全部
			</view>
			<view class="rq">
				<view class="rq_item" v-for="item,index in timeList" :key="index" @click="handleTime(item)">
					{{item.date}}
					<view class="">{{item.week}}</view>
					<view class="">{{item.nu_source?'可约':'无号'}}</view>
				</view>
			</view>
		</view>
		<view class="detail">
			<view class="detail_item" v-for="item,index in timeseleList" :key="index">
				<image class="detail_img" :src="item.avatar" mode=""></image>
				<view class="detail_con">
					{{item.post}} ： {{item.name}}
					<view class="detail_desc">
						{{item.good_at}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getTimesele,
		getDate,
		timeEvery
	} from '../../utils/api.js'
	export default {
		data() {
			return {
				timeseleList: [],
				timeList: [],
				id: ''
			};
		},
		onLoad(options) {
			this.id = options.id
			// 获取医生信息
			getTimesele({
					dep_id: options.id
				}).then(res => {
					console.log(res);
					this.timeseleList = res.data.data
					console.log(this.timeseleList[0].name);
				}),
				// 获取日期
				getDate({
					dep_id: options.id
				}).then(res => {
					console.log('日期', res);
					this.timeList = res.data.data
				})
		},
		created() {

		},
		methods: {
			// 获取时间
			handleTime(item) {
				console.log(item);
				timeEvery({
					dep_id: this.id,
					week: item.date
				}).then(res => {
					console.log('67', res);
					this.timeseleList = res.data.data
				})
			}
		}
	}
</script>

<style lang="scss">
	.detail {
		width: 750rpx;
	}

	.detail_item {
		width: 750rpx;
		display: flex;
		align-items: center;
	}

	.detail_img {
		width: 200rpx;
		height: 160rpx;
	}

	.detail_con {
		margin-left: 20rpx;
		font-size: 40rpx;
		font-weight: 500;
	}

	.detail_desc {
		margin-top: 20rpx;
		font-size: 32rpx;
	}

	.qb {
		width: 750rpx;
		height: 160rpx;
		display: flex;
		align-items: center;
		text-align: center;
	}

	.qb_item {
		width: 80rpx;
		height: 160rpx;
		line-height: 160rpx;
	}

	.rq {
		width: 100%;
		display: flex;
		align-items: center;
		white-space: nowrap;
		overflow: scroll;
	}

	.rq_item {
		width: 180rpx;
		padding: 20rpx;
	}
</style>